home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 3: Developer Tools / Linux Cubed Series 3 - Developer Tools.iso / devel / make / icmake-6.000 / icmake-6 / icmake / rss / getint16.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-02-08  |  791 b   |  36 lines

  1. /*
  2. \funcref{getint16}{INT16 getint16 (\params)}
  3.     {
  4.         {FILE} {*infile} {binary macro file to read from}
  5.     }
  6.     {16-bits integer read from {\em infile}}
  7.     {}
  8.     {getopcode(), getstring()}
  9.     {getint16.c}
  10.     {
  11.         This function reads a 16-bit signed integer value from the binary macro
  12.         file, supplied as argument. It may be used, e.g., to read an argument
  13.         of a {\em op\_asp} opcode.
  14.  
  15.         The returned result may be cast to {\em unsigned} by the caller.
  16.     }
  17. */
  18.  
  19. #include "icrssdef.h"
  20.  
  21. INT16 getint16 (infile)
  22. FILE *infile;
  23. {
  24.     INT16
  25.         tmp;
  26.     register INT32
  27.         offs;
  28.  
  29.     offs = ftell (infile);
  30.  
  31.     if (! fread (&tmp, sizeof (INT16), 1, infile) )
  32.         error ("argument read error at offset %u", (unsigned) offs);
  33.  
  34.     return (tmp);
  35. }
  36.